<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/axios.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
	</head>
	<body>
		<div id="app">
			<table class="table">
				<tr>
					<td>编号</td>
					<td>书名</td>
					<td>内容</td>
					<td>图片</td>
				</tr>
				<tr v-for="v in collect">
					<td>{{v.ID}}</td>
					<td>{{v.name}}</td>
					<td>{{v.content}}</td>
					<td><img :src="v.img" width="50px"></td>
				</tr>
			</table>
			<input type="button" value="上一页" @click="pageDat(page-1)"/>
			<input type="button" :value="v" v-for="v in sum" @click="pageData(v)"/>
			<input type="button" value="下一页" @click="pageDat(page+1)"/>
		</div>
	</body>
</html>
<script>
var app=new Vue({
	el:"#app",
	data:{
		collect:[],
		sum:'',
		page:'',
		count:'',
		size:'',
	},methods:{
		pageData(page){
			axios.get("http://127.0.0.1:8080/list?user_id=1&page="+page).then(function(res){
				app.collect=res.data.data
				app.sum=res.data.sum
				app.page=res.data.page
				app.count=res.data.count
				app.size=res.data.size
			})
		},
	},created:function(){
		axios.get("http://127.0.0.1:8080/list?user_id=1").then(function(res){
			app.collect=res.data.data
			app.sum=res.data.sum
			app.page=res.data.page
			app.count=res.data.count
			app.size=res.data.size
		
		})
	}
})	
</script>